<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>MKTB15</TITLE>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="../css/IDEA.css" type=text/css rel=stylesheet>
<SCRIPT language=javascript src="../js/IDEA_body.js"
	type=text/javascript></SCRIPT>
<link rel="stylesheet" type="text/css"
	href="../js/window/skin/qq/ymPrompt.css" />
<SCRIPT language=javascript src="../js/window/ymPrompt_Ex.js"
	type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="../js/window/ymPrompt_source.js"
	type=text/javascript></SCRIPT>
	<SCRIPT language=javascript src="../js/ajax.js" type=text/javascript></SCRIPT>
<script type="text/javascript">
 function openService()
 {
	 ymPrompt.win({message:'../station/querySystemInfo.html',width:800,height:400,title:'子系统信息查询',iframe:true});
 }
 var systemId='';
 function setSystemValue(systemValue)
 {
    var info = new Array;
    info = systemValue.split(",");
    systemId = document.getElementById("systemId").value;
    if(systemId != info[0])
    {
       document.getElementById("systemName").value=info[1];  
       document.getElementById("systemId").value=info[0];
       systemId = document.getElementById("systemId").value;
    }
    return;
 }
 
 function validate(myform)
 {
    if(myform.getAttribute("resourceName").value=='')
    {
        alert('请输入资源名称');  
      
        return false;
    }
//     if(myform.getAttribute("systemId").value=='')
//     {
//         alert("请选择业务系统");
        
//         return false;
//     }
    if(myform.getAttribute("resourceType").value=='')
    {
        alert("请输入资源类型");
        
        return false;
    }
    if(myform.getAttribute("resourceValue").value=='')
    {
        alert("请输入资源值");
        
        return false;
    }
    
        if(myform.getAttribute("isExist").value!="0")
    {
        alert("资源名称已存在");
        
        return false;
    }
 }
 
 function checkResourceName(obj)
    {
    	if(obj.value!="")
    	{
    		var url = "../resource/checkResourceName.html?resourceName="+encodeURIComponent(encodeURIComponent(obj.value));
    		sendRequest1(url);
    	}
    }
  //发送请求函数
	function sendRequest1(url) {
		createXMLHttpRequest();
		XMLHttpReq.open("GET", url, true);
		XMLHttpReq.onreadystatechange = processResponse1;//指定响应函数
		XMLHttpReq.send(null);  // 发送请求
	}
	// 处理返回信息函数
     function processResponse1() {
	    if (XMLHttpReq.readyState == 4) 
	    {

	        var isExist = XMLHttpReq.responseText;
	        if(isExist!="0")
	        {
	        	document.getElementById("errMsg").innerHTML="资源名称已存在";
	        	document.getElementById("isExist").value=isExist;
	        }
	        else
	        {
	        	document.getElementById("errMsg").innerHTML="";
	        	document.getElementById("isExist").value=isExist;
	        }
        }
    }
</script>
<META content="MSHTML 6.00.2900.3243" name=GENERATOR>
</HEAD>
<BODY>
<form name="myform" method="POST"
	action="../resource/addResourceInfo.html"
	onsubmit="return validate(this);">
<TABLE width="100%" height="100%" border=0 cellPadding=0 cellSpacing=0>
	<TBODY>
		<TR>
			<TD height="100%" bgcolor="#FFFFFF" class=right_bg>
			<table width="100%" height="5" border="0" cellpadding="0"
				cellspacing="0">
				<tr>
					<td></td>
				</tr>
			</table>
			<table width="100%" border="0" align="center" cellpadding="0"
				cellspacing="0">
				<tr>
					<td width="20">&nbsp;</td>
					<td class="text_12_title">当前位置: <a href="#" class="blue_1">首页</a>&gt;
					<a href="#">资源管理</a> &gt; <a href="#">资源信息维护</a> &gt; 增加资源信息</td>
				</tr>
			</table>
			<table width="100%" height="10" border="0" cellpadding="0"
				cellspacing="0">
				<tr>
					<td></td>
				</tr>
			</table>
			<table width="98%" border="0" cellpadding="0" cellspacing="0"
				background="../images/bg_body_title.jpg" class="list_border1">
				<tr>
					<td width="10">&nbsp;</td>
					<td>
					<table border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td></td>
							<td valign="bottom" class="text_12_border">新增菜单权限</td>
							<td></td>
						</tr>
					</table>
					</td>
				</tr>
			</table>
			<table width="98%" border="0" cellpadding="0" cellspacing="0"
				class="list_border2">
				<tr>
					<td align="center" valign="top">
					<table width="98%" height="10" border="0" cellpadding="0"
						cellspacing="0">
						<tr>
							<td></td>
						</tr>
					</table>
					<TABLE class=list_border cellSpacing=0 cellPadding=0 width="98%"
						border=0>
						<TBODY>
							<TR>
								<TD class=list_td_gray width="140">权限名称 ：</TD>
								<TD class=list_td_white_line><input name="resourceName"
									type="text" class="INPUT2" height="20" onchange="checkResourceName(this)"> <span
									class="text_darkred">*</span>
									&nbsp;<span id="errMsg" class="text_darkred"></span>
									<input type="hidden" id="isExist" value="">
									<input type="hidden" name="resourceType" value="MENU">
									</TD>
							</TR>
<!-- 							<TR> -->
<!-- 								<TD class=list_td_gray height=30>业务系统 ：</TD> -->
<!-- 								<TD height=30 class=list_td_white_line><INPUT class=INPUT2 -->
<!-- 									type="text" id="systemName" name="systemName" readonly="true"><input -->
<!-- 									type="button" name="selectSystem" onclick="openService();" -->
<!-- 									value="请选择业务系统"> <INPUT type="hidden" id="systemId" -->
<!-- 									name="systemId"><span class="text_darkred">*</span> -->
<!-- 									</TD> -->
<!-- 							</TR> -->
<!-- 							<TR> -->
<!-- 								<TD class=list_td_gray width="140">资源类型 ：</TD> -->
<!-- 								<TD class=list_td_white_line><select name="resourceType"> -->
<!-- 								    <option value=''>请选择</option> -->
<!-- 									<option value='WORKFLOWPERM'>工作流组</option> -->
<!-- 									<option value='DATAPERM'>数据</option> -->
<!-- 									<option value='OPERPERM'>操作</option> -->
<!-- 									<option value='MENU'>菜单</option> -->
<!-- 								</select> <span class="text_darkred">*</span></TD> -->
<!-- 							</TR> -->
							<TR>
								<TD class=list_td_gray width="140">权限ID ：</TD>
								<TD class=list_td_white_line><input name="resourceValue"
									type="text" class="INPUT2" height="20"> <span
									class="text_darkred">*</span></TD>
							</TR>
							<TR>
								<TD class=list_td_gray height=30>权限描述 ：</TD>
								<TD height=30 class=list_td_white_line><textarea
									id="resourceDesc" name="resourceDesc"></textarea></TD>
							</TR>
						</TBODY>
					</TABLE>
					<table width="98%" height="42" border="0" cellpadding="0"
						cellspacing="0">
						<tr>
							<td width="40%" align="center"><input name="Submit2"
								type="submit" class="button_normal" value="完  成">
							&nbsp;&nbsp; <input name="Submit3" type="button"
								class="button_normal" value="返  回"
								onclick="window.location.href='../resource/queryResourceInfos.html'"></td>
						</tr>
					</table>
					</td>
				</tr>
			</table>
			<table width="98%" height="5" border="0" cellpadding="0"
				cellspacing="0">
				<tr>
					<td></td>
				</tr>
			</table>
			</TD>
		</TR>
	</TBODY>
</TABLE>
</FORM>
</BODY>
</HTML>
